<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %> 
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<html>
<head>
  <title>职位管理</title>
  
  <script>
    $(document).ready(function() {
      /*$('#apply').click(function() {
        var error = null;
        var options = {
          'dataType': 'json',
          'data': {'pid': ${position.id}},
          'cache': false,
          'success': function(resp) {
            if (resp && (resp.err || resp.errStr)) {
              // window.alert(resp.err + ', ' + resp.errStr);
              if (typeof console !== 'undefined' && console.log) {
                console.log(resp.err + ', ' + resp.errStr);
              }
            }
            (success || $.noop)(resp);
          },
          'error': function(xhr, textStatus, errorThrown) {
              // window.alert(errorThrown);
              if (typeof console !== 'undefined' && console.log) {
                console.log(xhr, textStatus, errorThrown);
              }
              (error || $.noop)(xhr, textStatus, errorThrown);
          }
        };
        $.ajax('<c:out value="${ctx}"/>/member/application/post', options);
      });*/
    });
  </script>
</head>

<body>
  <c:if test="${not empty message}">
      <div id="message" class="alert alert-success"><button data-dismiss="alert" class="close">×</button>${message}</div>
  </c:if>
  <div>
    <div>${position.name}</div>
    <div><a href="${ctx}/jobsearch/company/${position.company.id}">${position.company.name}</a></div>
    <div><b>公司行业：</b>${position.company.industry.name}</div>
    <div><b>公司性质：</b>${position.company.typeName}</div>
    <div><b>公司规模：</b>${position.company.sizeName}</div>
    <div>职位信息</div>
    <div><table>
        <tr>
          <td><b>发布日期：</b></td><td><fmt:formatDate value="${position.refreshDate}" type="date"/></td>
          <td><b>工作地点：</b></td><td>${position.provinceName} - ${position.cityName}</td>
          <td><b>招聘人数：</b></td><td>${position.count}</td>
        </tr>
        <tr>
          <td><b>工作年限：</b></td><td>${position.workingYearsName}</td>
          <td><b>语言要求：</b></td><td>${position.languageName}</td>
          <td><b>学历：</b></td><td>${position.educationName}</td>
        </tr>
    </table></div>
    <div>${position.description}</div>
    <form id="inputForm" action="${ctx}/member/application/post" method="post">
        <input type="hidden" name="pid" value="${position.id}"/>
        <button id="apply" type="submit">立刻申请</button>
    </form>
    <form id="inputForm" action="${ctx}/member/bookmark/save/position" method="post">
        <input type="hidden" name="pid" value="${position.id}"/>
        <button id="apply" type="submit">收藏职位</button>
    </form>
  </div>
</body>
</html>
